import os 

# 从命令行参数获取值
# dataset = sys.argv[1]
# model = sys.argv[2]
# output_dir = sys.argv[3]
dataset = "humaneval"
model = "gpt-3.5-turbo-0613"
output_dir = "outputs"

# 定义其他变量
strategy = "simple"
root_dir = f"../output_data/{strategy}/{dataset}/{model}/"
dataset_path = f"../input_data/{dataset}/dataset/probs.jsonl"
testfile = f"../input_data/{dataset}/test/tests.jsonl"
n_proc = "1"
port = "8000"
verbose = True  # 根据需要，可以改为False

# 构建命令行参数列表
cmd_args = [
    "/home/xling/miniconda2/envs/ldb/bin/python", "main.py",
    "--run_name", output_dir,
    "--root_dir", root_dir,
    "--dataset_path", dataset_path,
    "--strategy", strategy,
    "--model", model,
    "--n_proc", n_proc,
    "--testfile", testfile,
    "--verbose",
    "--port", port
]

import subprocess

# 执行命令
try:
    # 使用subprocess.run来执行命令
    result = subprocess.run(cmd_args, check=True)
    print(f"Command executed successfully with return code {result.returncode}")
except subprocess.CalledProcessError as e:
    print(f"An error occurred while executing the command: {e}")